import bb.cascades 1.0

Page {
    titleBar: TitleBar {
        id: titleBar
        visibility: ChromeVisibility.Visible
        title: lang.setting_title
    }
    
    paneProperties: NavigationPaneProperties {
        backButton: ActionItem {
            onTriggered: {
                // define what happens when back button is pressed here
                // in this case is closed the detail page
                homeNavigation.backButtonsVisible = false ;
                homeNavigation.pop() ;
            }
        }
    }
    
    Container {
        Container {
            layout: StackLayout {
                orientation: LayoutOrientation.LeftToRight
            }
            horizontalAlignment: HorizontalAlignment.Center
            topPadding: 30
            maxWidth: 700
            
            Label {
                layoutProperties: StackLayoutProperties {
                    spaceQuota: 2
                }
                verticalAlignment: VerticalAlignment.Center
                text: lang.setting_language
            }
            
            Container {
                layoutProperties: StackLayoutProperties {
                    spaceQuota: 5
                }
                layout: StackLayout {
                    orientation: LayoutOrientation.LeftToRight
                }
                Button {
                    text: "English"
                    
                    onClicked:{
                        lang.lang = "en" ;
                        backend.setLang("en");
                    }
                }
                
                Button {
                    text: "中文"
                    
                    onClicked:{
                        lang.lang = "cn" ;
                        backend.setLang("cn");
                    }
                }
            }
        }
    }
    
    onCreationCompleted: {
        homeNavigation.backButtonsVisible = true ;
    }
}
